<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateChannelLogs extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('channel_logs', function (Blueprint $table) {
            $table->id();
            $table->integer('channel_id')->default(0)->comment('渠道标识');
            $table->integer('index')->default(0)->comment('次数序列');
            $table->timestamp('start_time')->comment('开始(启动)时间');
            $table->timestamp('end_time')->nullable(true)->comment('结束时间');
            $table->integer('usage_seconds')->default(0)->comment('总计使用时长（秒）');
            $table->timestamps();
            $table->softDeletes();
        });
        DB::statement("ALTER TABLE channel_logs COMMENT '渠道标识详情'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('channel_logs');
    }
}
